package com.check.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.check.dao.ExpressDao;
import com.check.pojo.Express;
import com.check.pojo.ExpressDetail;
import com.check.pojo.ExpressOther;
import com.check.pojo.MarkRole;
import com.check.pojo.Opr;

@Repository("expressDao")
public class ExpressDaoImpl extends BaseSqlMapDao implements ExpressDao{

	public List<Express> findAllExpressByPage(Map<Object, Object> map) {
		return getSqlMapClientTemplate().queryForList("Express.findAllExpressByPage",map);
	}

	public int findExpressCount() {
		return ((Integer) getSqlMapClientTemplate().queryForObject("Express.findExpressCount")).intValue();
	}

	public void insertExpress(Express express) {
		insertObject("Express.insertExpress", express);
	}

	public void insertExpressOther(ExpressOther expressOther) {
		insertObject("Express.insertExpressOther", expressOther);
	}

	public Express findExpressByExpId(String expId) {
		return (Express) getSqlMapClientTemplate().queryForObject("Express.findExpressByExpId",expId);
	}

	public List<ExpressOther> findAllExpressOtherByExpId(String expId) {
		return getSqlMapClientTemplate().queryForList("Express.findAllExpressOtherByExpId",expId);
	}

	public void updateExpress(Express express) {
		updateObject("Express.updateExpress", express);
	}

	public void deleteExpressOtherByExpId(String expId) {
		deleteObject("Express.deleteExpressOtherByExpId", expId);
	}

	public void deleteExpress(String expId) {
		deleteObject("Express.deleteExpressByExpId", expId);
	}

	public int checkExistExpress() {
		return ((Integer) getSqlMapClientTemplate().queryForObject("Express.checkExistExpress")).intValue();
	}

	public int checkExistDetailExpress() {
		return ((Integer) getSqlMapClientTemplate().queryForObject("Express.checkExistDetailExpress")).intValue();

	}

	public void doInsertBatchDept() {
		getSqlMapClientTemplate().insert("Express.insertBatchDept");
	}

	public void doInsertBatchPerson() {
		getSqlMapClientTemplate().insert("Express.insertBatchPerson");
		
	}

	public void deleteExpressDetailData() {
		getSqlMapClientTemplate().delete("Express.deleteExpressDetail");
	}

	public List<ExpressDetail> findAllExpressDetail() {
		return getSqlMapClientTemplate().queryForList("Express.findAllExpressDetail");
	}

	public String getWorkRoleTypeByMark(String markRoleId) {
		String type = (String)getSqlMapClientTemplate().queryForObject("Express.selectWorkRoleTypeByMarkRole", markRoleId);
		return type;
	}

	public List queryPersonMark(Map map) {
		return getSqlMapClientTemplate().queryForList("Express.queryPersonMark",map);
	}

	public List<MarkRole> findAllCheckMarkRole() {
		return getSqlMapClientTemplate().queryForList("Express.findAllCheckMarkRole");
	}

	public List<MarkRole> findAllAgencyCheckMarkRole() {
		return getSqlMapClientTemplate().queryForList("Express.findAllAgencyCheckMarkRole");
	}

	public List<Opr> checkExistPerson(String oprId) {
		return getSqlMapClientTemplate().queryForList("Express.checkExistPerson",oprId);
	}

	public void doInsertSimplePerson(String oprId) {
		 getSqlMapClientTemplate().insert("Express.insertSimplePerson",oprId);
	}
	
	public List<ExpressDetail> findPersonExpressDetail(String checkId) {
		return getSqlMapClientTemplate().queryForList("Express.findPersonExpressDetail",checkId);
	}

	public List<Express> findAllExpress() {
		return getSqlMapClientTemplate().queryForList("Express.findAllExpress");
	}

}
